package com.qiyueoffice.dao.impl;

import java.sql.SQLException;

import org.apache.log4j.Logger;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.qiyueoffice.dao.EmployeeDao;
import com.qiyueoffice.util.SqlMapUtil;
import com.qiyueoffice.vo.Employee;

public class EmployeeDaoImpl implements EmployeeDao {
	private SqlMapUtil sqlMapUtil = new SqlMapUtil();

	private final String LOGIN = "employee.login";

	private static final Logger log = Logger.getLogger(EmployeeDaoImpl.class);

	public Employee login(Employee employee) {
		SqlMapClient sqlMap = sqlMapUtil.getSqlMapClient();
		Employee emp = null;
		try {
			sqlMap.startTransaction();

			emp = (Employee) sqlMap.queryForObject(LOGIN, employee);

			sqlMap.commitTransaction();

		} catch (SQLException e) {
			// TODO Auto-generated catch block
			log.error("Exception EmployeeDaoImpl login()", e);
		}
		return emp;
	}

}
